using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using NBear.Common;
using NBear.Common.JSON;

public partial class AjaxTemplates_DemoData2 : NBear.Web.UI.AjaxTemplate
{
    protected string content;

    public override void OnAjaxTemplatePreRender(System.Collections.Generic.Dictionary<string, string> callbackParams)
    {
        string jstContent = LoadJstContentFromUserControl("../" + callbackParams["jst"]);

        JSONObject json = new JSONObject();
        string jsonStr = new EntitySerializer(EntitySerializeType.Json).SerializeArray(Gateways.TestAccessDb.SelectAll<TestAccessDbAccessEntities.User>());
        JSONArray users = new JSONArray(jsonStr);
        json.put("users", users);
        json.put("jst", jstContent);

        content = json.ToString();
    }
}
